package com.ruoyi.logistic.controller;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.logistic.domain.*;
import com.ruoyi.logistic.domain.vo.NetworkSheetFeeFillCollectCollectVo;
import com.ruoyi.logistic.domain.vo.NetworkSheetFeeFillCollectDetailVo;
import com.ruoyi.logistic.service.INetworkTransferMoneyService;
import com.ruoyi.logistic.service.NetworkSheetFeeFillCollectDetailService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.sql.Date;
import java.util.List;

@RequestMapping("/network/feeFillCollect")
@RestController
@Api(tags = "网点财务_面单费补收")
public class NetworkSheetFeeFillCollectDetailController {
    @Autowired
    private NetworkSheetFeeFillCollectDetailService networkSheetFeeFillCollectDetailService;
    @ApiOperation("显示面单费补收明细列表")
    @GetMapping("/detail/selectAll")
    public R selectAllDetail(PageDate pageDate){
        List<NetworkSheetFeeFillCollectDetail> networkSheetFeeFillCollectDetailList = networkSheetFeeFillCollectDetailService.selectAll(pageDate);
        if (networkSheetFeeFillCollectDetailList == null || networkSheetFeeFillCollectDetailList.size() == 0){
            return R.fail("暂无数据");
        }else {
            return R.ok(PageInfo.info(networkSheetFeeFillCollectDetailList));
        }
    }
    @ApiOperation("添加面单费补收明细")
    @PostMapping("/detail/insert")
    public R insert(@RequestBody NetworkSheetFeeFillCollectDetail networkSheetFeeFillCollectDetail){
        Boolean isAdd = networkSheetFeeFillCollectDetailService.insert(networkSheetFeeFillCollectDetail);
        if (isAdd){
            return R.ok("添加成功");
        }else {
            return R.fail("添加失败");
        }
    }
    @ApiOperation("修改面单费补收明细")
    @PostMapping("/detail/update")
    public R update(@RequestBody NetworkSheetFeeFillCollectDetail networkSheetFeeFillCollectDetail){
        Boolean isUpdate = networkSheetFeeFillCollectDetailService.update(networkSheetFeeFillCollectDetail);
        if (isUpdate){
            return R.ok("修改成功");
        }else {
            return R.fail("修改失败");
        }
    }
    @ApiOperation("删除面单费补收明细")
    @PostMapping("/detail/deleteById")
    public R deleteById(Integer id){
        Boolean isDelete = networkSheetFeeFillCollectDetailService.deleteById(id);
        if (isDelete){
            return R.ok("删除成功");
        }else {
            return R.fail("删除失败");
        }
    }
    @ApiOperation("搜索面单费补收明细列表")
    @PostMapping("/detail/search")
    public R search(@RequestBody @Param("networkSheetFeeFillCollectDetailVo") NetworkSheetFeeFillCollectDetailVo networkSheetFeeFillCollectDetailVo){
        List<NetworkSheetFeeFillCollectDetail> networkSheetFeeFillCollectDetailList = networkSheetFeeFillCollectDetailService.search(networkSheetFeeFillCollectDetailVo);
        if (networkSheetFeeFillCollectDetailList == null || networkSheetFeeFillCollectDetailList.size() == 0){
            return R.fail("暂无数据");
        }else {
            return R.ok(PageInfo.info(networkSheetFeeFillCollectDetailList));
        }
    }
    @ApiOperation("面单费补收汇总")
    @PostMapping("/collect")
    public R collect(@RequestBody NetworkSheetFeeFillCollectCollectVo vo){
        List<NetworkSheetFeeFillCollectCollect> collectCollectList = networkSheetFeeFillCollectDetailService.collect(vo);
        if (collectCollectList == null || collectCollectList.size() == 0){
            return R.fail("暂无数据");
        }else {
            return R.ok(PageInfo.info(collectCollectList));
        }
    }
}
